﻿using System;
using System.Text.RegularExpressions;
using System.Collections;
namespace LabaCS3
{
    public class Chapter
    {
        public string chapters;
        public Chapter (string chapter)
        {
           chapters = chapter;
        }
    }

    public class Book : PrintEdition, IEnumerable
    {


        private ArrayList chapterList;
        public Book()
        {
            chapterList = new ArrayList();
        }
        public void AddChapter (Chapter c)
        {
            chapterList.Add(c);

        }
        public void RemoveChaprer(int chapterToRemove)
        {
            chapterList.RemoveAt(chapterToRemove);

        }

        public int ChapterCount
        {
            get { return chapterList.Count; }
        }
        public bool ChapterIsPresent(Chapter c)
        {
            return chapterList.Contains(c);

        }
     

        public IEnumerator GetEnumerator()
        {
            return chapterList.GetEnumerator();
        }



        public Book(string title, string author, int cost)
            : base(title, author, cost)
        {
            chapterList = new ArrayList();

        }

        public Book(string title, string author, int cost, Content content)
            : base(title, author, cost, content)
        {
            chapterList = new ArrayList();

        }

        
        public override void NameClass()
        {
            Console.WriteLine("Class is Book");
        }

    }

}